package com.bawei.company

import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.bawei.base.mvvm.BaseActivity
import com.bawei.company.databinding.ActivityCompanyApplyDetailBinding
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
@Route(path = "/company/CompanyApplyDetailActivity")
class CompanyapplyDetailActivity :
    BaseActivity<ActivityCompanyApplyDetailBinding, CompanyViewModel>() {
    lateinit var applyAdapter: ApplyAdapter
    @JvmField
    @Autowired
    var id = 0
    override fun initView() {
        applyAdapter= ApplyAdapter()
        ARouter.getInstance().inject(this)
        viewModel.companyApplyDetail(id)
        binding.companyApplyRec.adapter=applyAdapter
        binding.companyApplyRec.layoutManager=LinearLayoutManager(this)
    }

    override fun initData() {
        viewModel.companyApplyDetailSuccess.observe(this){
            applyAdapter.data.clear()
            applyAdapter.data.addAll(it.processingSteps)
            applyAdapter.notifyDataSetChanged()
            binding.companyDetailStatuTv.text=it.status
            binding.companyDetailTitle.text=it.status
            binding.companyDetailTitle.text=it.status
            binding.companyApplyNumber.text=it.applicationNumber
            binding.companyApplyName.text=it.enterpriseName
            binding.companyApplyPerson.text=it.contactName
            binding.companyApplyUpTime.text=it.entryTime
            binding.companyApplyArea.text=it.applicationArea.toString()+"m²"
            binding.companyApplyPersonNumber.text=it.entryPersonnel.toString()+"人"
            binding.companyApplyPhone.text=it.contactMethod

        }
    }

}